package com.acme.task4;

import java.util.Random;

public class DemoTask4 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		int n = 10;
		
		int array[] = new int[n];
		generate(array);
		System.out.println("Check rand:");
		check(array);

		System.out.println("Check without 9:");
		check(new int[] {3, 3, 3, 7, 3, 7, 3});
		System.out.println("Check without 3:");
		check(new int[] {9, 9, 7, 7, 9, 7, 9});
		System.out.println("Check without 7:");
		check(new int[] {3, 9, 3, 9, 3, 9, 3});
		
	}
	
	private static void check(int[] array) {
		int number3 = 0, number7 = 0, number9 = 0;
		for (int i : array) {
			switch (i) {
				case 3:
					number3++;
					break;
				case 7:
					number7++;
					break;
				case 9:
					number9++;
					break;
			}
		}
		System.out.println("Number of 3: " + number3);
		System.out.println("Number of 7: " + number7);
		System.out.println("Number of 9: " + number9);
	}
	
	private static void generate(int[] array) {
		Random random = new Random();
		System.out.print("Random generate array: ");
		//random.setSeed();
		for (int i = 0 ; i < array.length; i++) {
			int type = (int)(random.nextGaussian() * 2);
			switch (type) {
				case 0:
					array[i] = 3;
					break;
				case 1:
					array[i] = 7;
					break;
				case 2: 
					array[i] = 9;
					break;
			}
			System.out.print(array[i] + " ");
		}
		System.out.print("\n");
	}

}
